package com.jams.goodox.activity.serve.tenement;

import android.content.Intent;
import android.widget.TextView;

import com.jams.goodox.BaseActivity;
import com.jams.goodox.R;
import com.jams.goodox.entity.TenementMonthBean;
import com.jams.goodox.utils.DataCacheManager;
import com.jams.goodox.utils.StyleUtil;

import java.text.DecimalFormat;

import butterknife.Bind;

/**
 * Created by jams_zhen on 2016/9/29.
 * 账单详情
 */

public class TenementOrderDetail extends BaseActivity {
    @Bind(R.id.tx_part)
    TextView txPart;
    @Bind(R.id.tx_address)
    TextView txAddres;
    @Bind(R.id.tx_yearMonth)
    TextView txYearMonth;
    @Bind(R.id.tx_payMoney)
    TextView txPayMoney;
    @Bind(R.id.tx_period)
    TextView txPeriod;
    @Bind(R.id.tx_unitPrice)
    TextView txUnitPrice;
    @Bind(R.id.tx_count)
    TextView txCount;

    private TenementMonthBean.DataBean.BillMonthListBean billMonthBean;
    private DecimalFormat decimalFormat ;

    @Override
    protected int getLayoutId() {
        return R.layout.tenement_order_detail;
    }

    @Override
    protected void init() {
        StyleUtil.titleBackKey(this, "账单详情");
        decimalFormat= new DecimalFormat("#0.00");
        Intent in=getIntent();
        billMonthBean=(TenementMonthBean.DataBean.BillMonthListBean)in.getSerializableExtra("bean");
        if(billMonthBean==null)
            return;
        txPart.setText(""+in.getStringExtra("item"));
        String address= DataCacheManager.getInstance().getUser().getEnterpriseAddress();
        txAddres.setText(address);
        txYearMonth.setText(""+billMonthBean.getBillMonth());
        txPayMoney.setText(getResources().getString(R.string.rmb)+decimalFormat.format(billMonthBean.getTotalPrice()));
        txPeriod.setText(""+billMonthBean.getPeriod());
        //单位价格保持两位小数
        txUnitPrice.setText(getResources().getString(R.string.rmb)+decimalFormat.format(billMonthBean.getPrice())+"/"+billMonthBean.getUnit());
        txCount.setText(""+billMonthBean.getCount());

    }

}
